package com.ysd.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.ysd.service.messageservice;
import com.ysd.util.BaseServlet;
import com.ysd.util.Result;

@WebServlet("/messageServlet")
public class messageServlet extends BaseServlet {
	messageservice message=new messageservice();
	public void getAdd(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String name=request.getParameter("name").toString();
		String uphone=request.getParameter("uphone").toString();
		String email=request.getParameter("email").toString();
		String content=request.getParameter("content").toString();
		
		int i=message.add(name, uphone, email, content);
		Result rs=new Result(200,"true",i,"success");
		Gson g=new Gson();
		PrintWriter out=response.getWriter();
		out.print(g.toJson(rs));
		out.flush();
		out.close();
	}

}
